#pragma once

#include<pthread.h>

class LockGuard
{
public:
    LockGuard(pthread_mutex_t* pmtx)
    :_pmtx(pmtx)
    {
        pthread_mutex_lock(_pmtx);
    }
    ~LockGuard()
    {
        pthread_mutex_unlock(_pmtx);
    }

private:
    pthread_mutex_t* _pmtx;
};